import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

export const HomeRouter=[
    {
      path: '/index/availability',
      name: 'availability',
      title:'房源管理',
      component: () => import('../pages/index/availability/index.vue'),
    },
    {
      path: '/index/buy',
      name: 'buy',
      title:'团购管理',
      component: () => import('../pages/index/buy/index.vue'),
    },
    {
      path: '/index/liveBroadcast',
      name: 'liveBroadcast',
      title:'直播管理',
      component: () => import('../pages/index/liveBroadcast/index.vue'),
    },
    {
      path: '/index/audit',
      name: 'audit',
      title:'审核管理',
      component: () => import('../pages/index/audit/index.vue'),
    },
    {
      path: '/index/order',
      name: 'order',
      title:'订单管理',
      component: () => import('../pages/index/order/index.vue'),
    },
    {
      path: '/index/information',
      name: 'information',
      title:'资讯管理',
      component: () => import('../pages/index/information/index.vue'),
    },
    {
      path: '/index/broker',
      name: 'broker',
      title:'经纪人管理',
      component: () => import('../pages/index/broker/index.vue'),
    },
    {
      path: '/index/employee',
      name: 'employee',
      title:'员工管理',
      component: () => import('../pages/index/employee/index.vue'),
    },
    {
      path: '/index/user',
      name: 'user',
      title:'用户管理',
      component: () => import('../pages/index/user/index.vue'),
    }
  ]

export const routes: Array<RouteConfig> = [
  {
    path: '/index',
    name: 'index',
    component: () => import('../pages/index/index.vue'),
    children:HomeRouter
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../pages/login/index.vue')
  },
  {
    path: '/*',
    name: '404',
    component: () => import('../pages/404/index.vue')
  },
  {
    path: '/',
    redirect:'/login'
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
